﻿using SXICE.Core.Domains;
using SXICE.Core.Models;
using SXICE.IService.Models;
using System;
using System.Collections.Generic;
using System.Text;

namespace SXICE.IService
{
    /// <summary>
    /// 权限服务接口
    /// </summary>
    public interface IRightsService
    {
        /// <summary>
        /// 获取所有角色
        /// </summary>
        /// <returns></returns>
        ReturnResult<List<Roles>> GetRoles();

        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="name">要添加的角色名称</param>
        /// <returns>结果</returns>
        ReturnResult AddRole(string name);

        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="id">要删除的角色</param>
        /// <returns>结果</returns>
        ReturnResult DeleteRole(int id);

        /// <summary>
        /// 修改角色
        /// </summary>
        /// <param name="roles">要修改的角色</param>
        /// <returns>结果</returns>
        ReturnResult UpdateRole(Roles roles);

        /// <summary>
        /// 获取菜单列表
        /// </summary>
        /// <returns>结果</returns>
        ReturnResult<List<Menu>> GetMenus();

        /// <summary>
        /// 根据角色ID获取菜单
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <returns>结果</returns>
        ReturnResult<List<Menu>> GetMenusByRoleId(int roleId);

        /// <summary>
        /// 根据角色ID获取权限列表DTO
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <returns>结果</returns>
        ReturnResult<List<RightsDTO>> GetRightsDTO(int roleId);

        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <param name="menuIds">菜单ID</param>
        /// <returns>结果</returns>
        ReturnResult AddRights(int roleId, List<int> menuIds);

        /// <summary>
        /// 根据角色ID获取权限列表
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <returns>结果</returns>
        ReturnResult<List<Rights>> GetRights(int roleId);

        /// <summary>
        /// 是否有权限
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <param name="code">编码</param>
        /// <returns>结果</returns>
        ReturnResult HasRights(int roleId, string code);
    }
}
